# $Id$
# Maintainer: Jan "heftig" Steffens <jan.steffens@gmail.com>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Brandon Niemczyk <maccorin@cfl.rr.com>

pkgname=frozen-bubble
_pkgver=2.2.1-beta1
pkgver=${_pkgver/-/}
pkgrel=11
pkgdesc="A game in which you throw colorful bubbles and build groups to destroy the bubbles"
arch=(i686 x86_64)
url="http://www.frozen-bubble.org"
license=(GPL2)
depends=(perl-sdl perl-ipc-system-simple perl-compress-bzip2 perl-file-which)
makedepends=(perl-file-slurp perl-locale-maketext-lexicon perl-module-build)
options=('!emptydirs')
source=(http://www.frozen-bubble.org/data/$pkgname-$_pkgver.tar.bz2 \
        frozen-bubble.desktop)
md5sums=('825cc23ed806838b9d86de9982a5687a'
         '01b10b77ba6ad856f5c199121c582272')

build() {
  cd "$srcdir/$pkgname-$_pkgver"
  unset CFLAGS
  # install module in vendor directories
  perl Build.PL installdirs=vendor
  perl Build
}

check() {
  cd "$srcdir/$pkgname-$_pkgver"
  perl Build test
}

package() {
  cd "$srcdir/$pkgname-$_pkgver"
  perl Build install destdir="$pkgdir"

  install -D -m644 share/icons/frozen-bubble-icon-64x64.png "$pkgdir/usr/share/pixmaps/frozen-bubble.png"
  install -D -m644 "$srcdir/frozen-bubble.desktop" "$pkgdir/usr/share/applications/frozen-bubble.desktop"

# template start; name=perl-binary-module-dependency; version=1;
if [[ $(find "$pkgdir/usr/lib/perl5/" -name "*.so") ]]; then
	_perlver_min=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);')
	_perlver_max=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]+1);')
	depends+=("perl>=$_perlver_min" "perl<$_perlver_max")
fi
# template end;
}
